package com.leetcode.algorithm.y22.m06;

/**
 * 167. 两数之和 II - 输入有序数组
 * 
 * https://leetcode.cn/problems/two-sum-ii-input-array-is-sorted/
 * 
 * @author jie.deng
 *
 */
class Question0167Solution01 {
	
		public int[] twoSum(int[] numbers, int target) {
			int left = 0;
			int right = numbers.length - 1;
			while (numbers[left] + numbers[right] != target) {
				if (numbers[left] + numbers[right] > target) {
					right--;
				} else {
					left++;
				}
			}
	
			return new int[] { left + 1, right + 1 };
		}
    
}